<?php

/**
 * Description of Account
 *
 * @author XaeroDegreaz
 */
require_once ("Beanstalk_API/Beanstalk_API.php");
final class Beanstalk_API_Account extends Beanstalk_API {
    //put your code here

    public function Find($remote_xml="api/account.xml") {
	$account = $this->initialize($remote_xml);
	//echo $this->domain;
	return $account;
    }

    public function Save($items, $remote_xml="api/account.xml") {
	$numargs = func_num_args();
	$args = func_get_args();

	$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
	$xml .="<account>";

	foreach($items as $key=>$val) {
	    $xml .= "<".$key.">$val</".$key.">";
	}
	
	$xml .="</account>";

	$resource = fopen("php://memory", "rw");
	fwrite($resource, $xml);
	rewind($resource);

	$result = $this->initialize($remote_xml, array($resource,$xml));

	fclose($resource);

	return array($result, $xml);
    }

}
?>
